<template>
    <div>
        <h2>组件展示的title:{{ title }}</h2>
        <p>组件展示的content:{{ content }}</p>
        <p v-if="author">by:{{ author }}</p>
        <!-- 让组件继承父组件传过来的NotPropAttribute -->
        <div :class="$attrs.class">我是NotPropAttribute组件</div>   
    </div>
</template>

<script>
export default {
    inheritAttrs: false,    //不让根组件继承NotPropAttribute
    props: {
        title: {
            type: String,
            require: true,
            default: "123"
        },
        content: {
            type: String,
            require: true,
            default: "456"
        },
        author: [String, Number],  //多个可能的值
        infoType: {  //自定义验证函数    
            validator(value) {   //当输入的是'success','warning','danger'中一个时候,返回true
                return ['success', 'warning', 'danger'].includes(value)
            }
        },
        propG: {
            type: Function,
            default() {
                return 'default function'
            }
        }
    }
}
</script>

<style lang="scss" scoped>
</style>